package cn.pugle.oj.leetcode;

import cn.pugle.oj.catalog.DynamicProblem;

/**
 * 结果是斐波那契数列
 *
 * @author tzp
 * @since 2020/9/15
 */
public class LC70 implements DynamicProblem {

    public int climbStairs(int n) {
        if (n == 0 || n == 1) return 1;
        int[] state = new int[n + 1];
        state[0] = 1;
        state[1] = 1;

        for (int i = 2; i <= n; i++) {
            state[i] = state[i - 1] + state[i - 2];
        }
        return state[n];
    }

    public static void main(String[] args) {
        System.out.println(new LC70().climbStairs(0));
        System.out.println(new LC70().climbStairs(1));
        System.out.println(new LC70().climbStairs(2));
        System.out.println(new LC70().climbStairs(4));
        System.out.println(new LC70().climbStairs(8));
    }
}
